package gallery
{
    import org.kolonitsky.alexey.net.XMLService;
    import org.kolonitsky.alexey.collections.IList;
    
    public class GalleryXMLService extends XMLService
    {
        public function GalleryXMLService ()
        {
            super();
        }



        
        //----------------------------------------------------------------------
        // 
        // Implement IList interface
        //
        //----------------------------------------------------------------------

        public function get length():int
        {
            return images.length();
        }

        public function getItemAt(index:int):Object
        {
            var node:XML = images[index];
            var result:Object =
            {
                image: String(node.@src),
                title: String(node.@title)
            };
            return result
        }

        

        //----------------------------------------------------------------------
        // 
        // Override XMLService API
        //
        //----------------------------------------------------------------------

        override protected function pars():void
        {
            images = lastData..img;
        }



        
        //----------------------------------------------------------------------
        // 
        // Private logic
        //
        //----------------------------------------------------------------------

        private var images:XMLList = null;
    }
}